package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 评价结果条目
 *
 * @author ytche
 * @date 2017年7月21日
 *
 */
@JsonApiResource(type = "appraiseResultItem")
@Entity
@Table(name = "appraise_result_item")
public class AppraiseResultItem extends BaseEntity {

	private static final long serialVersionUID = 1L;
	private AppraiseResult result;
	private AppraiseItem item;
	private String name;
	private Integer score;
	private String remark;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "result_id")
	public AppraiseResult getResult() {
		return result;
	}

	public void setResult(AppraiseResult result) {
		this.result = result;
	}

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "score")
	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "item_id")
	public AppraiseItem getItem() {
		return item;
	}

	public void setItem(AppraiseItem item) {
		this.item = item;
	}

}
